//
//  IndexHeaderCollectionReusableView.m
//  PropertyManager
//
//  Created by TNG on 2018/7/11.
//  Copyright © 2018年 Tng. All rights reserved.
//

#import "IndexHeaderCollectionReusableView.h"

@implementation IndexHeaderCollectionReusableView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self creatUI];
        self.backgroundColor = SFMNavBarColor;
    }
    return self;
}

-(void)creatUI{
    
    [self addSubview:self.img];
    [self addSubview:self.nameLabel];
    [self addSubview:self.scanBtn];
}

-(UIImageView *)img
{
    if (_img == nil) {
        _img = [[UIImageView alloc] initWithFrame:CGRectMake(WIDTH/2 - 17, 54 + kStatusBarH, 34, 34)];
        _img.contentMode = UIViewContentModeScaleAspectFill;
        _img.clipsToBounds = YES;
        _img.image  = [UIImage imageNamed:@"logo-white"];
    }
    return _img;
}

-(UILabel *)nameLabel
{
    if (_nameLabel == nil) {
        _nameLabel = [[UILabel alloc] initWithFrame:CGRectMake(0, 108 + kStatusBarH, WIDTH, 20)];
        _nameLabel.font = font(18);
        _nameLabel.textColor = SFMColor(255, 255, 255);
        _nameLabel.textAlignment = NSTextAlignmentCenter;
        _nameLabel.text = @"广百展贸股份有限公司";
    }
    return _nameLabel;
}

-(UIButton *)scanBtn
{
    if (_scanBtn == nil) {
        _scanBtn = [[UIButton alloc] initWithFrame:CGRectMake(WIDTH - 54, kStatusBarH + 2,44, 40)];
        UIImageView * img = [[UIImageView alloc] initWithFrame:CGRectMake(10, 8, 24, 24)];
        img.image = [UIImage imageNamed:@"WechatIMG1484"];
        [_scanBtn addSubview:img];
        _scanBtn.hidden = YES;
    }
    return _scanBtn;
}

@end
